package com.itmg.analyze.jp.url.impl;

import org.apache.log4j.Logger;

import com.itmg.analyze.jp.bean.KakakuParaBean;
import com.itmg.analyze.jp.model.KakakuSearchParamModel;
import com.itmg.analyze.jp.url.IURLAnalyze;
import com.itmg.cache.StaticInformationBean;
import com.itmg.vo.SearchParameterVO;
import com.itmg.vo.TargetDataVO;

/**
 *  获得匹配好的url
 * 
 * @author xuehaipeng
 * @version 1.0
 * */

public class KakakuURlAnlyzeImpl implements IURLAnalyze {
	protected Logger log = Logger.getLogger(KakakuURlAnlyzeImpl.class.getName());
	private String rootURL = "http://api.kakaku.com/Ver1.1/ItemSearch.aspx";
	private String charset = "utf8";
	private String hitNum = "20";
	private String sourceSiteName = "価格.com";
	public KakakuURlAnlyzeImpl() {
		// TODO Auto-generated constructor stub
	}
	public TargetDataVO getURLDataByParameter(SearchParameterVO searchParameterVO) throws Exception {
		// TODO Auto-generated method stub
		KakakuSearchParamModel kakakuSearchParamModel = KakakuParaBean.getKakakuSearchParamModel(searchParameterVO);
		kakakuSearchParamModel.setCategoryGroup(StaticInformationBean.getNameByCategory(searchParameterVO.getCategory(), "kakaku"));
		kakakuSearchParamModel.setCharset(charset);
		kakakuSearchParamModel.setHitNum(hitNum);
		TargetDataVO targetDataVO = new TargetDataVO();
		targetDataVO.setSourceSiteName(sourceSiteName);
		targetDataVO.setUrl(rootURL+kakakuSearchParamModel.getURLPara());
log.info(targetDataVO.getUrl());
		return targetDataVO;
	}
}
